<template>
    <div class="app-container">
    
    
    
        <div class="filter-container">
    
    
    
            <el-form>
    
    
    
                <el-form-item>
    
    
    
                    <el-button type="primary" icon="plus" v-if="hasPerm('user:add')" @click="showCreate">添加
    
    
    
                    </el-button>
    
    
    
                    <el-button type="danger" @click="delSelect"  >
    
    
    
                        批量删除
    
    
    
                    </el-button>
    
    
    
                </el-form-item>
    
    
    
            </el-form>
    
    
    
        </div>
    
    
    
        <div class="searchWord">
    
    
    
            <el-input v-model="search" placeholder="请输入搜索内容" @input="inputFunction()">
    
    
    
            </el-input>
    
    
    
        </div>
    
    
    
        <br>
    
    
    
        <el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row @selection-change="handleSelectionChange">
    
    
    
            <el-table-column type="selection" width="55" fixed>
    
    
    
            </el-table-column>
    
    
    
    
    
            <el-table-column align="center" label="序号" width="80" fixed>
    
    
    
                <template slot-scope="scope">
    
    
    
                              <span v-text="getIndex(scope.$index)"> </span>
</template>
      </el-table-column>
      <el-table-column align="center" label="真实姓名" prop="staffNameEn" width="80"></el-table-column>
      <el-table-column align="center" label="昵称" prop="nickname" width="150"></el-table-column>
      <el-table-column align="center" label="用户名" prop="username" width="150"></el-table-column>
      <el-table-column align="center" label="角色" width="100">
<template slot-scope="scope">
    <el-tag type="success" v-text="scope.row.roleName" v-if="scope.row.roleId===1">
    
    </el-tag>
    
    <el-tag type="primary" v-text="scope.row.roleName" v-else></el-tag>
</template>
      </el-table-column>
      <el-table-column align="center" label="年龄" prop="age" width="60"></el-table-column>
      <el-table-column align="center" label="生日" prop="birthday" width="100"></el-table-column>
      <el-table-column align="center" label="证件类型" prop="certificateType" width="100"></el-table-column>
      <el-table-column align="center" label="证件号码" prop="certificateNumber" width="170"></el-table-column>
      <el-table-column align="center" label="联系电话" prop="phone" width="170"></el-table-column>
      <el-table-column align="center" label="学历" prop="degreeName" width="100"></el-table-column>
      <el-table-column align="center" label="邮箱" prop="email" width="180"></el-table-column>
      <el-table-column align="center" label="紧急联系人" prop="emergencyPeople" width="100"></el-table-column>
      <el-table-column align="center" label="紧急联系人电话" prop="emergencyPhone" width="170"></el-table-column>
      <el-table-column align="center" label="性别" prop="gender" width="80"></el-table-column>
      <el-table-column align="center" label="毕业学校" prop="graduated_from" width="170"></el-table-column>
      <el-table-column align="center" label="民族" prop="nation" width="80"></el-table-column>
      <el-table-column align="center" label="国家" prop="nationality" width="80"></el-table-column>
      <el-table-column align="center" label="籍贯" prop="native" width="80"></el-table-column>
      <el-table-column align="center" label="岗位" prop="positionName" width="110"></el-table-column>
      <el-table-column align="center" label="创建时间" prop="createTime" width="170"></el-table-column>
      <el-table-column align="center" label="最近修改时间" prop="updateTime" width="170"></el-table-column>
      <el-table-column align="center" label="管理" width="320" v-if="hasPerm('user:update')" fixed="right">
<template slot-scope="scope">
    <el-button type="primary" @click="showDetails(scope.$index)"  v-if="hasPerm('user:list')">
    
        详情</el-button>
    
    <el-button type="primary" icon="edit" @click="showUpdate(scope.$index)"  v-if="hasPerm('user:update')">修改</el-button>
    
    <el-button type="danger" icon="delete" v-if="scope.row.userId!=userId"  @click="removeUser(scope.$index)">删除
    
    </el-button>
</template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="listQuery.pageNum"
      :page-size="listQuery.pageRow"
      :total="totalCount"
      :page-sizes="[5, 20, 50, 100]"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
    
    
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"  width="30%" >
      <el-form class="small-space" :model="tempUser" label-position="left" label-width="80px"
               style='width: 200px; margin-left:50px;' :inline="true">
        <el-form-item label="用户名" required v-if="dialogStatus=='create'">
          <el-input type="text" v-model="tempUser.username">
          </el-input>
        </el-form-item>
        <el-form-item label="密码" v-if="dialogStatus=='create'" required>
          <el-input show-password v-model="tempUser.password" placeholder="不填则默认不修改">
          </el-input>
        </el-form-item>
        <el-form-item label="新密码" v-if = "dialogStatus=='update'" >
          <el-input type="password" v-model="tempUser.password" placeholder="不填则表示不修改">
          </el-input>
        </el-form-item>
        <el-form-item label="角色" required>
          <el-select v-model="tempUser.roleId" placeholder="请选择">
            <el-option
              v-for="item in roles"
              :key="item.roleId"
              :label="item.roleName"
              :value="item.roleId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="昵称" required>
          <el-input type="text" v-model="tempUser.nickname">
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button v-if="dialogStatus=='create'" type="success" @click="createUser">创 建</el-button>
        <el-button type="primary" v-else @click="updateUser">修 改</el-button>
      </div>
    </el-dialog>


    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogStaffDetailsVisible"  width="65%" top="1vh"  >
      <el-form :model="tempUser" ref="tempUser" label-width="125px">
        <el-row>
          <el-col :span="8">
             <el-form-item label="我的账号" required>
                  <i v-if="textMap[dialogStatus] == '详细信息'" :disabled="true">{{tempUser.username}}</i>
                  
                  <el-input v-model="tempUser.username" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false" @keyup.native = "jusername" placeholder="请填写字母，不能填写中文"></el-input>
                  <!-- <el-tag type="danger">{{jusername_info}}</el-tag> -->
                 
             </el-form-item>
          </el-col>
          <el-col :span="8">
             <el-form-item label="我的密码"  v-if="textMap[dialogStatus] == '编辑' || textMap[dialogStatus] == '添加员工'" required>
                <el-input v-model="tempUser.password" type="password" v-if="textMap[dialogStatus] == '编辑'" :disabled="false" placeholder="不填则默认不修改"></el-input>
                <el-input v-model="tempUser.password" type="password" v-if="textMap[dialogStatus] == '添加员工'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="中文姓名" required>
                <i  v-if="textMap[dialogStatus] == '详细信息'" :disabled="true">{{tempUser.staffNameEn}}</i>
                <el-input v-model="tempUser.staffNameEn" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="试用截止日期" v-if="textMap[dialogStatus] != '添加员工' & textMap[dialogStatus] != '编辑'">
                <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.probationEndDate}}</i>
                <!-- <el-input v-model="tempUser.probationEndDate" v-if="textMap[dialogStatus] != '详细信息'" :disabled="true"></el-input> -->
            </el-form-item>
          </el-col>
          
        </el-row>
        
        <el-row>
          <el-col :span="8">
            <el-form-item label="证件类型" required>
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.certificateId}}</i>
              
              <el-select v-model="tempUser.certificateId" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false" style="width:100%">
                <el-option
                  v-for="item in certificates"
                  :key="item.certificate_id"
                  :label="item.certificate_name"
                  :value="item.certificate_id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
             <el-form-item label="证件号码" required>
                <i  v-if="textMap[dialogStatus] == '详细信息'" :disabled="true">{{tempUser.certificateNumber}}</i>
                <el-input v-model="tempUser.certificateNumber" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
             <!-- <el-form-item label="性别">
              <el-input v-model="tempUser.gender" v-if="textMap[dialogStatus] == '详细信息'" :disabled="true"></el-input>
              <el-input v-model="tempUser.gender" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
          </el-form-item> -->

          <el-form-item label="我的性别" required>
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.gender}}</i>
                <el-select size= "medium" v-model="tempUser.gender" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false" style="width:100%">
                  <el-option
                    v-for="item in sexs"
                    :key="item.sex_id"
                    :label="item.sex_name"
                    :value="item.sex_name">
                  </el-option>
                </el-select>
              
            </el-form-item>
          </el-col>
        </el-row>
        
        <el-row>
          <el-col :span="8">
             <el-form-item label="我的年龄" required>
                <i  v-if="textMap[dialogStatus] == '详细信息'" :disabled="true">{{tempUser.age}}</i>
                <el-input v-model="tempUser.age" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="我的昵称" required>
                <i  v-if="textMap[dialogStatus] == '详细信息'" :disabled="true">{{tempUser.nickname}}</i>
                <el-input v-model="tempUser.nickname" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
             <el-form-item label="我的生日" v-if="textMap[dialogStatus] == '详细信息'" required>
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.birthday}}</i>
            </el-form-item>

            <el-form-item label="我的生日" v-if="textMap[dialogStatus] != '详细信息'" required>
                <div class="block" style="width:100%">
                  <el-date-picker
                    v-model="tempUser.birthday"
                    align="right"
                    type="date"
                    placeholder="选择日期"
                    :picker-options="pickerOptions1"
                    style="width:100%">
                  </el-date-picker>
                </div>
                <!-- <i  v-if="textMap[dialogStatus] == '详细信息'" :disabled="true">{{tempUser.nickname}}</i>
                <el-input v-model="tempUser.nickname" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input> -->
            </el-form-item>
          </el-col>
          
        </el-row>
        
       
       <el-row>
         <el-col :span="8">
           <!-- <el-form-item label="联系电话">
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.phone}}</i>
                
                <el-input v-model="tempUser.phone" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item> -->
            <el-form-item label="我的部门" v-if="textMap[dialogStatus] != '详细信息' & textMap[dialogStatus] == '添加员工'" required>
              <!-- 添加的时候 -->
              <el-select style="width:100%" v-model="tempUser.departmentName" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息' & textMap[dialogStatus] == '添加员工'" :disabled="false">
                  <el-option
                    v-for="item in departments"
                    :key="item.department_id"
                    :label="item.department_name"
                    :value="item.department_id">
                  </el-option>
                  
                </el-select>

            </el-form-item>
            
            <el-form-item label="联系电话" v-if="textMap[dialogStatus] == '详细信息'" required>
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.phone}}</i>
                  
                  
            </el-form-item>
            <el-form-item label="联系电话" v-if="textMap[dialogStatus] == '编辑'" required>
                <!-- <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.phone}}</i> -->
                <el-input v-model="tempUser.phone" v-if="textMap[dialogStatus] == '编辑'" :disabled="false"></el-input>
            </el-form-item>

         </el-col>
         <el-col :span="8">
           <el-form-item label="我的岗位" required>
            <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.positionName}}</i>
            
              <el-select style="width:100%" v-model="tempUser.positionName" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false">
                <el-option
                  v-for="item in positions"
                  :key="item.position_id"
                  :label="item.position_name"
                  :value="item.position_id">
                </el-option>
              </el-select>
              
          </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="我的角色" required>
            <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.roleName}}</i>
              
              <el-select style="width:100%" v-model="tempUser.roleId" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false">
                <el-option
                  v-for="item in roles"
                  :key="item.roleId"
                  :label="item.roleName"
                  :value="item.roleId">
                </el-option>
              </el-select>
          </el-form-item>

         </el-col>
       </el-row>
       

        <el-row>
          <el-col :span="8">
            <el-form-item label="我的状态" required>
                <!-- <el-input v-model="tempUser.staff_state" v-if="textMap[dialogStatus] == '详细信息'" :disabled="true"></el-input> -->
                <!-- <el-input v-model="tempUser.staff_state" ></el-input> -->
                <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.staff_state_name}}</i>
                
                <el-select style="width:100%" v-model="tempUser.staff_state" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false" >
                  <el-option
                    v-for="item in staffStates"
                    :key="item.state_id"
                    :label="item.state_name"
                    :value="item.state_id">
                  </el-option>
                </el-select>
                
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="我的学历" required>
                <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.degreeName}}</i>
                  
                  <el-select style="width:100%" v-model="tempUser.degreeId" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false">
                    <el-option
                      v-for="item in degrees"
                      :key="item.degree_id"
                      :label="item.degree_name"
                      :value="item.degree_id">
                    </el-option>
                  </el-select>

            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="我的邮箱" required>
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.email}}</i>
                
                <el-input v-model="tempUser.email" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        
        <el-row>
          <el-col :span="8">
            <el-form-item label="毕业院校" required>
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.graduated_from}}</i>
                
                <el-input v-model="tempUser.graduated_from" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="我的专业" required>
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.major}}</i>
                
                <el-input v-model="tempUser.major" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="婚姻状况" required>
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.marital_status}}</i>
                
                <el-select style="width:100%" v-model="tempUser.marital_status" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false">
                  <el-option
                    v-for="item in maritals"
                    :key="item.marriage_id"
                    :label="item.marriage_name"
                    :value="item.marriage_id">
                  </el-option>
                </el-select>
              </el-form-item>
          </el-col>
        </el-row>
        
        <el-row>
          <el-col :span="8">
            <el-form-item label="我的民族" required>
                <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.nation}}</i>
                
                <el-input v-model="tempUser.nation" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="我的国籍" required>
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.nationality}}</i>
                
                <el-input v-model="tempUser.nationality" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="我的籍贯" required>
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.native}}</i>
                
                <el-input v-model="tempUser.native" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        
        <el-row>
          
          <el-col :span="8">
            <el-form-item label="联系电话" v-if="textMap[dialogStatus] != '详细信息' & textMap[dialogStatus] != '编辑'" required>
                
                <el-input v-model="tempUser.phone" :disabled="false"></el-input>
            </el-form-item>

          </el-col>
            
          <el-col :span="8">
            
            <el-form-item label="紧急联系人" required>
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.emergencyPeople}}</i>
                
                <el-input v-model="tempUser.emergencyPeople" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="紧急电话" required>
                  <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.emergencyPhone}}</i>
                
                <el-input v-model="tempUser.emergencyPhone" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="入职时间" v-if="textMap[dialogStatus] != '添加员工' & textMap[dialogStatus] != '编辑'">
                <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.entryTime}}</i>
                
                <!-- <el-input v-model="tempUser.entryTime" v-if="textMap[dialogStatus] != '详细信息'" :disabled="true"></el-input> -->
            </el-form-item>
          </el-col>
          <el-col :span="20">
            <el-form-item label="我的部门" v-if="textMap[dialogStatus] == '编辑'" required >
              <!-- 添加的时候 -->
              <el-select style="width:100%" v-model="tempUser.departmentName" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息' & textMap[dialogStatus] == '添加员工'" :disabled="false">
                  <el-option
                    v-for="item in departments"
                    :key="item.department_id"
                    :label="item.department_name"
                    :value="item.department_id">
                  </el-option>
                  
                </el-select>

                <el-row v-if="dialogStatus == 'details'">
                    <i v-for="(dept,index) in tempUser.departmentList" :key="dept.departmentId">
                      <el-col :span="6">
                        <el-button type="primary" @click="showArch(dept,tempUser)" v-if="textMap[dialogStatus] == '详细信息'">部门{{index + 1}}: &nbsp &nbsp &nbsp {{dept.departmentName}}</el-button>
                      </el-col>
                    </i>
                </el-row>

                <el-row v-if="textMap[dialogStatus] == '编辑'">
                  
                    <i v-for="(dept) in tempUser.departmentList" :key="dept.departmentId">
                      <el-col :span="6">
                        <el-button @click="showArch(dept,tempUser)">{{dept.departmentName}}</el-button>
                      </el-col>
                    </i>
                    
                  
                  <el-col :span="5">
                    <el-button type="primary" @click="changeDepartment(tempUser.departmentList)">编辑部门</el-button>
                  </el-col>
                </el-row>
          
            </el-form-item>

          </el-col>
          
          
          
        </el-row>
        
        <el-row>
          <el-col :span="8">
            <el-form-item label="离职时间" v-if="textMap[dialogStatus] != '添加员工' & textMap[dialogStatus] != '编辑'">
            <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.leaveTime}}</i>
                
                <!-- <el-input v-model="tempUser.leaveTime" v-if="textMap[dialogStatus] != '详细信息'" :disabled="true"></el-input> -->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="合同签订日期" v-if="textMap[dialogStatus] != '添加员工' & textMap[dialogStatus] != '编辑' " >
              <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.contactStartDate}}</i>
                
                <!-- <el-input v-model="tempUser.contactStartDate" v-if="textMap[dialogStatus] != '详细信息'" :disabled="true"></el-input> -->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="合同截止日期" v-if="textMap[dialogStatus] != '添加员工' & textMap[dialogStatus] != '编辑'">
                <i  v-if="textMap[dialogStatus] == '详细信息'">{{tempUser.contactEndDate}}</i>
                
                <!-- <el-input v-model="tempUser.contactEndDate" v-if="textMap[dialogStatus] != '详细信息'" :disabled="true"></el-input> -->
            </el-form-item>
          </el-col>
        </el-row>
        
        <el-row>
          <el-col :span="20" v-if="dialogStatus == 'details'">
            <el-form-item label="我的部门" required >
              <!-- 添加的时候 -->
              <el-select style="width:100%" v-model="tempUser.departmentName" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息' & textMap[dialogStatus] == '添加员工'" :disabled="false">
                  <el-option
                    v-for="item in departments"
                    :key="item.department_id"
                    :label="item.department_name"
                    :value="item.department_id">
                  </el-option>
                  
                </el-select>

                <el-row v-if="dialogStatus == 'details'">
                  
                  
                    <i v-for="(dept,index) in tempUser.departmentList" :key="dept.departmentId">
                      <el-col :span="6">
                        <el-button type="primary" @click="showArch(dept,tempUser)" >部门{{index + 1}}: &nbsp &nbsp &nbsp {{dept.departmentName}}</el-button>
                      </el-col>

                    </i>
                 
                </el-row>

                <el-row v-if="textMap[dialogStatus] == '编辑'">
                  <el-col :span="6">
                    <!-- <div v-for="(dept,index) in tempUser.departmentList" :key="index">
                      {{ dept.departmentName }}
                    </div> -->
                    
                  </el-col>
                  <el-col :span="6">
                    <el-button type="primary" @click="changeDepartment(tempUser.departmentList)">编辑部门</el-button>
                  </el-col>
                </el-row>
                

                <!-- <div v-for="dept in tempUser.departmentList" :key="dept.departmentId" class="text item" v-if="textMap[dialogStatus] != '详细信息'">
                  <el-select v-model="dept.departmentName" placeholder="请选择" >
                    <el-option
                      v-for="item in departments"
                      :key="item.department_id"
                      :label="item.department_name"
                      :value="item.department_id">
                    </el-option>
                  </el-select>
                </div> -->
                  <!-- <div v-for="item in tempUser.departmentList" :key="item.id">
                    {{ item.departmentName }}
                  </div> -->
                  
                  
                
              
              <!-- 
                <el-select v-model="tempUser.departmentName" placeholder="请选择" v-if="textMap[dialogStatus] != '详细信息'" :disabled="false">
                  <el-option
                    v-for="item in departments"
                    :key="item.department_id"
                    :label="item.department_name"
                    :value="item.department_id">
                  </el-option>
                </el-select> -->
            </el-form-item>
          </el-col>
          
        </el-row>
        
       <!-- <el-form :model="form" ref="form" label-width="80px">
         <el-form-item label="">
           <el-input v-model="form.sss"></el-input>
         </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="onSubmit">立即创建</el-button>
           <el-button>取消</el-button>
         </el-form-item>
       </el-form> -->
       <!-- <el-form-item label="本人联系电话">
           <el-input v-model="tempUser.phone" :disabled="true"></el-input>
       </el-form-item> -->
       <!-- projects -->
       <el-table :data="projectByPerson" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit
              highlight-current-row v-if="textMap[dialogStatus] == '详细信息'">
         
          <el-table-column align="center" label="项目编号" prop="project_id" min-width="1"></el-table-column>
          <el-table-column align="center" label="项目名称" prop="project_name" min-width="1"></el-table-column>
          
          <el-table-column align="center" label="管理" min-width="1" v-if="hasPerm('project:list')">
<template slot-scope="scope">
    <el-button type="primary" @click="showProjectDetails(scope.$index)">
    
    
    
        详情</el-button>
</template>
          </el-table-column>
        </el-table>
      </el-form>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click=" dialogStaffDetailsVisible= false">取 消</el-button>
        <el-button v-if="dialogStatus=='create'" type="success" @click="createUser" :disabled="isCreate">创 建</el-button>
        <el-button v-else-if="dialogStatus == 'update'" type="primary"   @click="updateUser">修 改</el-button>
      </div>
    </el-dialog>

    <el-dialog
      title="所属部门"
      :visible.sync="dialogDeptFormVisible"
      width="32%"
      
      >
      <!-- :left-default-checked="[2, 3]"
        :right-default-checked="[1]" -->
      <el-transfer
        v-model="value3"
        filterable
        :render-content="renderFunc"
        :titles="['全部部门', '所属部门']"
        :button-texts="['去除', '添加']"
        :format="{
          noChecked: '${total}',
          hasChecked: '${checked}/${total}'
        }"
        @change="handleChange"
        :data="data">
        
      </el-transfer>
      <span slot="footer">
        <el-button @click="dialogDeptFormVisible = false">取 消</el-button>
        
        <el-button type="primary" @click="updateDepartments">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="项目详情"
      :visible.sync="dialogProjectFormVisible"
      width="42%"
      >

      <transition name="fade" mode="out-in">
        <!-- <router-view :key="key"></router-view> -->
        <router-view></router-view>
        
      </transition>
      
      <span slot="footer">
        <!-- dialogProjectFormVisible = false -->
        <el-button @click="cancelDialog">取 消</el-button>
      </span>
    </el-dialog>

      <!-- 删除提示框 -->
        <el-dialog title="提示" :visible.sync="delVisibleByBatch" width="300px" center>
            <div class="del-dialog-cnt">删除不可恢复，是否确定批量删除？</div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="delVisibleByBatch = false">取 消</el-button>
                <el-button type="primary" @click="delAll" >确 定</el-button>
            </span>
        </el-dialog>

    <el-dialog
      title="团队组织架构"
      :visible.sync="dialogDeptArchFormVisible"
      width="50%">
        <div trigger="hover"  style=" text-align:center;">
          <el-tag v-for="(dept,index) in departmentArch" :key="dept.department_id">
            <!-- content -->
            <el-card :body-style="{ padding: '0px' }">
              <div slot="header">
                <span>
                  <el-tag type="warning">{{departmentArch.length - index}}级部门：</el-tag><br/>

                </span>
              </div>
              <!-- card body -->
              <br>
              <el-tag type="success">{{dept.department_name}}</el-tag>
              <br/>
              <br/>
              <el-tag type="info">主管：{{dept.nickname}}</el-tag>
              <br>
            </el-card>
            <i class="el-icon-arrow-right"></i>
          </el-tag>
        </div>
        <br>
        <br>
        <!-- <el-carousel trigger="hover" height="250px" style=" text-align:center;"> -->
        <el-carousel :interval="4000" height="300px">
          <el-carousel-item v-for="(deptPerson,index) in departmentPerson" :key="index" style="text-align:center" >
            
            <el-tag>所属部门{{index+1}}人员</el-tag>
            <br>
            <br>
            <el-table :data="deptPerson" v-loading.body="listLoading" element-loading-text="拼命加载中" fit height="250"
              highlight-current-row :row-class-name="tableRowClassName">
              <el-table-column align="center" label="序号" min-width="1">
<template slot-scope="scope">
    <span v-text="getIndex(scope.$index)"> </span>
</template>
              </el-table-column>
              <el-table-column align="center" label="工号" prop="staff_id" min-width="1"></el-table-column>
              <el-table-column align="center" label="昵称" prop="nickname" min-width="1"></el-table-column>
            </el-table>
          </el-carousel-item>
        </el-carousel>
      <span slot="footer">
        <el-button @click="dialogDeptArchFormVisible = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
// author:zandaoguang
import { mapGetters } from 'vuex'

export default {
    data() {

        const generateData = _ => {
            const data = [];

            return data;
        };
        return {

            jusername_info: true,

            // 时间选择器开始

            pickerOptions1: {
                disabledDate(time) {
                    return time.getTime() > Date.now();
                },
                shortcuts: [{
                    text: '今天',
                    onClick(picker) {
                        picker.$emit('pick', new Date());
                    }
                }, {
                    text: '昨天',
                    onClick(picker) {
                        const date = new Date();
                        date.setTime(date.getTime() - 3600 * 1000 * 24);
                        picker.$emit('pick', date);
                    }
                }, {
                    text: '一周前',
                    onClick(picker) {
                        const date = new Date();
                        date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', date);
                    }
                }]
            },
            value1: '',
            birthday: '',

            // 时间选择器结束
            data: [],
            value3: [

            ],
            renderFunc(h, option) { return h('span', `${option.key} - ${option.label} `); },
            totalCount: 0, //分页组件--数据总条数
            list: [], //表格的数据
            listLoading: false, //数据加载等待动画
            listQuery: {
                pageNum: 1, //页码
                pageRow: 5, //每页条数
                name: '',
            },

            roles: [], //角色列表
            departments: [], //部门列表
            positions: [], //岗位列表
            departmentArch: [], //部门
            maritals: [{
                    marriage_id: 1,
                    marriage_name: '未婚'
                },
                {
                    marriage_id: 2,
                    marriage_name: '已婚'
                },
                {
                    marriage_id: 3,
                    marriage_name: '丧偶'
                },
                {
                    marriage_id: 4,
                    marriage_name: '离婚'
                }
            ],
            staffStates: [{
                    state_id: 1,
                    state_name: '实习员工'
                },
                {
                    state_id: 2,
                    state_name: '正式员工'
                },
                {
                    state_id: 3,
                    state_name: '离职员工'
                },
            ],
            degrees: [{
                    degree_id: 1,
                    degree_name: '小学'
                },
                {
                    degree_id: 2,
                    degree_name: '初中'
                },
                {
                    degree_id: 3,
                    degree_name: '高中'
                },
                {
                    degree_id: 4,
                    degree_name: '中专'
                },
                {
                    degree_id: 5,
                    degree_name: '大专'
                },
                {
                    degree_id: 6,
                    degree_name: '本科'
                },
                {
                    degree_id: 7,
                    degree_name: '硕士研究生'
                },
                {
                    degree_id: 8,
                    degree_name: '博士研究生'
                },

            ],
            sexs: [{
                    sex_id: 1,
                    sex_name: '男'
                },
                {
                    sex_id: 2,
                    sex_name: '女'
                },
            ],
            certificates: [{
                    certificate_id: 1,
                    certificate_name: '居民身份证'
                },
                // {
                //     certificate_id: 2,
                //     certificate_name: '出生证'
                // },
                {
                    certificate_id: 3,
                    certificate_name: '护照'
                },
                // {
                //     certificate_id: 4,
                //     certificate_name: '警官证'
                // },
                // {
                //     certificate_id: 5,
                //     certificate_name: '执行公务证'
                // },
                // {
                //     certificate_id: 6,
                //     certificate_name: '学生证'
                // },
                // {
                //     certificate_id: 7,
                //     certificate_name: '毕业证'
                // },
                // {
                //     certificate_id: 8,
                //     certificate_name: '签证'
                // },
                // {
                //     certificate_id: 9,
                //     certificate_name: '结婚证'
                // },
                // {
                //     certificate_id: 10,
                //     certificate_name: '离婚证'
                // },
            ],
            // 搜索框中的内容
            search: '',

            dialogStatus: 'create',
            // 控制添加，修改
            dialogFormVisible: false,
            // 查看详情
            dialogStaffDetailsVisible: false,
            dialogDeptFormVisible: false,
            dialogProjectFormVisible: false,
            dialogDeptArchFormVisible: false,
            delVisibleByBatch: false, //批量删除提示弹框的状态

            // 是否能创建，控制创建按钮
            isCreate: false,

            // 创建按钮时，
            curr_dept: {},
            curr_tempUser: [],

            // 员工属于哪些部门
            preDepartment: [],

            // 员工所属多个部门的员工
            departmentPerson: [],

            // 全部项目
            projects: [],

            // 每个项目
            projectByPerson: [],

            // 多选
            multipleSelection: [],

            textMap: {
                update: '编辑',
                create: '添加员工',
                details: "详细信息"
            },
            tempUser: {
                userId: '',
                age: '',
                certificateId: '',
                certificateType: '',
                certificateNumber: '',
                contactEndDate: '',
                contactStartDate: '',
                createTime: '',
                create_staff_id: '',
                degreeId: '',
                degreeName: '',
                deleteStatus: '',
                email: '',
                emergencyPeople: '',
                emergencyPhone: '',
                entryTime: '',
                gender: '',
                graduated_from: '',
                is_quit: '',
                leaveTime: '',
                major: '',
                marital_status: '',
                nation: '',
                nationality: '',
                native: '',
                nickname: '',
                phone: '',
                probationEndDate: '',
                roleName: '',
                staffNameEn: '',
                staff_state: '',
                staff_state_name: '',
                updateTime: '',
                update_staff_id: '',
                userId: '',
                username: '',
                password: '',
                roleId: '',
                departmentName: '',
                positionName: '',
                departmentList: [],
                positionList: [],
                value: [],
                preDepartment: [],
                birthday: '',
            },
            // 记录显示字段
            displayAttribute: {
                select: true,
                id: true,
                age: true,
                certificateNumber: true,
                contactEndDate: true,
                contactStartDate: true,
                createTime: true,
                create_staff_id: true,
                degreeId: true,
                deleteStatus: true,
                departmentName: true,
                email: true,
                emergencyPeople: true,
                emergencyPhone: true,
                entryTime: true,
                gender: true,
                graduated_from: true,
                is_quit: true,
                leaveTime: true,
                major: true,
                marital_status: true,
                nation: true,
                nationality: true,
                native: true,
                nickname: true,
                phone: true,
                positionName: true,
                probationEndDate: true,
                roleId: true,
                roleName: true,
                staffNameEn: true,
                staff_state: true,
                updateTime: true,
                update_staff_id: true,
                userId: true,
                username: true,
                password: false,
                roleId: false,
                departmentName: false,
                positionName: false,
                departmentList: false,
                positionList: false,
                value: false,
                preDepartment: false,
                birthday: false,
            }
        }
    },
    created() {
        this.getList();
        if (this.hasPerm('user:add') || this.hasPerm('user:update')) {
            this.getAllRoles();
        }
        if (this.hasPerm('department:add') || this.hasPerm('department:update')) {
            this.getAllDepartments();
        }
        if (this.hasPerm('position:add') || this.hasPerm('position:update')) {
            this.getAllPositions();
        }
        if (this.hasPerm('project:add') || this.hasPerm('project:update')) {
            this.getAllProjects();
        }
    },
    computed: {
        ...mapGetters([
            'userId'
        ]),

    },
    methods: {

        delSelect() {
            const length = this.multipleSelection.length;
            if (length == 0) {
                this.delWarnInfo();
            } else {
                this.delVisibleByBatch = true; //显示删除弹框
            }
            // this.delAll();
        },
        // 当批量删除的时候,如果要是没有选中,弹出提醒
        delWarnInfo() {
            this.$message('请选择您要删除的数据');
        },
        //批量删除
        delAll() {
            // alert("我进来啦~");
            var lengths = this.multipleSelection.length;
            console.log('length:', lengths);
            console.log('mul:', this.multipleSelection[0])
            // return;
            if (!this.hasPerm('user:delete')) {
                alert("不具备删除权限");
                    return;
            }
            for (let i = 0; i < lengths; i++) {
                // console.log('aaaaaaaaaaaaaaaaaaaaaaaa');
                console.log(this.multipleSelection[i]);
                this.multipleSelection[i].deleteStatus = '2';


                this.api({
                    url: "/user/updateUser",
                    method: "post",
                    data: this.multipleSelection[i]
                }).then(() => {
                    this.getList()
                }).catch(() => {
                    this.$message.error("删除失败")
                })
            }
            this.delVisibleByBatch = false; //关闭删除提示模态框
        },

        handleSelectionChange(val) {
            this.multipleSelection = val;
            console.log(this.multipleSelection);
        },

        jusername() {
            // alert("xxxxxxxxxxxxxx");
        },
        cancelDialog() {
            this.dialogProjectFormVisible = false;

        },
        tableRowClassName({ row, rowIndex }) {
            if (rowIndex === 1) {
                return 'warning-row';
            } else if (rowIndex === 3) {
                return 'success-row';
            }
            return '';
        },
        updateDepartments() {
            let _vue = this;
            // console.log('value3:', this.value3);
            // console.log('user', this.tempUser.userId);
            this.tempUser.value = this.value3;
            // console.log('preDepartment:', this.preDepartment);
            this.tempUser.preDepartment = this.preDepartment;
            // console.log('tempUser:', this.tempUser);
            // return;
            this.api({
                url: "/user/updateDepartment",
                method: "post",
                data: this.tempUser
            }).then(() => {
                let msg = "修改成功";
                // return 
                this.dialogStaffDetailsVisible = false;
                this.dialogDeptFormVisible = false;
                if (this.userId === this.tempUser.userId) {
                    msg = '修改成功,部分信息重新登录后生效'
                }
                // this.getList();
                this.$message({
                    message: msg,
                    type: 'success',
                    duration: 1 * 1000,
                    onClose: () => {
                        _vue.getList();
                    }
                })

            })


        },
        handleChange(value, direction, movedKeys) {
            console.log(value, direction, movedKeys);
        },
        changeDepartment(departmentList) {

            // console.log('depts:', this.departments);
            // return;
            // console.log('this.departments:', this.departments);
            this.preDepartment = [];
            for (var i = 0; i < departmentList.length; i++) {
                this.preDepartment.push(departmentList[i].deptId);
            }
            // this.preDepartment = departmentList;
            // console.log('deptListxxxxxxxxxxxxxxxx:', this.preDepartment);
            var json = JSON.parse(JSON.stringify(this.departments).replace(/department_id/g, "key"));
            json = JSON.parse(JSON.stringify(json).replace(/department_name/g, "label"));
            this.data = json;
            // console.log('deptList:', departmentList);
            // console.log('departmentList:', this.departments);
            // console.log('userId', this.tempUser.userId);
            // 清空，重新加载每个人的所属部门情况
            this.value3 = [];
            for (var i = 0; i < departmentList.length; i++) {
                for (var j = 0; j < this.departments.length; j++) {
                    if (departmentList[i].deptId === this.departments[j].department_id) {
                        this.value3.push(departmentList[i].deptId);
                        break;
                    }
                }
            }
            // return;
            // console.log('dept333333333333:', this.data);
            // return;
            this.dialogDeptFormVisible = true;
        },
        showArch(dept, tempUser) {

            this.curr_dept = dept,
                this.curr_tempUser = tempUser,
                console.log("1111", this.curr_dept);
            console.log('2222', this.curr_tempUser);
            this.getAllDepartmentsArch();
            this.getDepartmentPerson();
            this.dialogDeptArchFormVisible = true;


        },
        getDepartmentPerson() {
            console.log("curr_tempUser:", this.curr_tempUser);
            this.api({
                url: "/department/getDepartmentPerson",
                method: "post",
                data: this.curr_tempUser

            }).then(data => {
                console.log('gggggggggggggggg:', data);
                this.departmentPerson = data;
                console.log('departmentPerson:', this.departmentPerson);
            })
        },
        getAllDepartmentsArch() {
            this.api({
                url: "/department/getAllDepartmentsArch",
                method: "post",
                data: this.curr_dept

            }).then(data => {
                console.log('yyyyyyyyyyyyyyyy', data);
                this.departmentArch = data;
                console.log('departmentArch:', this.departmentArch);
            })
        },
        getAllRoles() {
            this.api({
                url: "/user/getAllRoles",
                method: "get"
            }).then(data => {
                this.roles = data.list;
                // console.log('role:', this.roles);
            })
        },
        inputFunction() {

            if (this.search) {
                // console.log('aaaaaaaaaaaaaaaa');
                this.getListBySearch(this.search);
            }
            if (this.search == "") {
                this.getList();
            }
        },
        getAllDepartments() {
            this.api({
                url: "/department/getAllDepartments",
                method: "get"
            }).then(data => {
                this.departments = data.list;
                console.log('departments:', this.departments);
            })
        },

        getAllPositions() {
            this.api({
                url: "/position/getAllPositions",
                method: "get"
            }).then(data => {
                this.positions = data.list;
                // console.log('positions:', this.positions);
            })
        },
        getAllProjects() {
            this.api({
                url: "/user/getAllProjects",
                method: "get"
            }).then(data => {
                this.projects = data.list;
                console.log('projects:', this.projects);
            })
        },
        getList() {
            //查询列表
            this.listLoading = true;
            this.api({
                url: "/user/list",
                method: "get",
                params: this.listQuery
            }).then(data => {
                // alert("xxxxxxxxxxxxxxxxx")
                // console.log('standard:');
                // console.log(data);
                // console.log('xxxxxxxxxxxxxxxxxxxxxxxxxxx');

                this.listLoading = false;
                this.list = data.list;
                console.log('list:', this.list);
                this.totalCount = data.totalCount;

                // 时间的处理
                // console.log('entryTime:', this.list[0].entryTime);
                // for(var i = 0 ; i < this.list.length ;i++){
                //   this.list[i].entryTime = this.renderTime(this.list[i].entryTime);
                //   this.list[i].contactEndDate = this.renderTime(this.list[i].contactEndDate);
                //   this.list[i].contactStartDate = this.renderTime(this.list[i].contactStartDate);
                //   this.list[i].probationEndDate = this.renderTime(this.list[i].probationEndDate);
                // }

                // console.log('entryTime:', this.list[0].entryTime);
            })
        },
        getListBySearch(val) {
            // console.log("val:"+val);
            //查询列表

            if (!this.hasPerm('user:list')) {
                return
            }
            this.listLoading = true;
            this.listQuery.value = val;
            console.log(this.listQuery);
            this.api({
                url: "/user/listUserBySearch",
                method: "get",
                params: this.listQuery
            }).then(data => {
                console.log(data);
                // return;
                this.listLoading = false;
                this.list = data.list;
                this.totalCount = data.totalCount;
            })
        },
        renderTime(date) {
            // var dateee = new Date(date).toJSON();
            var d = new Date(date);
            var times = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
            return times;
        },
        handleSizeChange(val) {
            //改变每页数量
            this.listQuery.pageRow = val
            this.handleFilter();
        },
        handleCurrentChange(val) {
            //改变页码
            this.listQuery.pageNum = val
            this.getList();
        },
        handleFilter() {
            //查询事件
            this.listQuery.pageNum = 1
            this.getList()
        },
        getIndex($index) {
            //表格序号
            return (this.listQuery.pageNum - 1) * this.listQuery.pageRow + $index + 1
        },
        showCreate() {
            let user = this.list[0];
            this.tempUser.certificateType = user.certificateType;
            this.tempUser.userId = user.userId;
            // console.log("userId:",this.tempUser.userId);
            //显示新增对话框
            this.tempUser.age = '';
            this.tempUser.certificateId = '';
            this.tempUser.certificateNumber = '';
            // this.tempUser.certificateType ='';
            this.tempUser.contactEndDate = '';
            this.tempUser.contactStartDate = '';
            this.tempUser.createTime = '';
            this.tempUser.create_staff_id = '';
            this.tempUser.degreeId = '';
            this.tempUser.degreeName = '';
            this.tempUser.deleteStatus = '';
            this.tempUser.departmentName = '';
            this.tempUser.email = '';
            this.tempUser.emergencyPeople = '';
            this.tempUser.emergencyPhone = '';
            this.tempUser.entryTime = '';
            this.tempUser.gender = '';
            this.tempUser.graduated_from = '';
            this.tempUser.is_quit = '';
            this.tempUser.leaveTime = '';
            this.tempUser.major = '';
            this.tempUser.marital_status = '';
            this.tempUser.nation = '';
            this.tempUser.nationality = '';
            this.tempUser.native = '';
            this.tempUser.nickname = '';
            this.tempUser.phone = '';
            this.tempUser.positionName = '';
            this.tempUser.probationEndDate = '';
            // this.tempUser.roleId = '';
            this.tempUser.roleName = '';
            this.tempUser.staffNameEn = '';
            this.tempUser.staff_state = '';
            this.tempUser.staff_state_name = '';
            this.tempUser.updateTime = '';
            this.tempUser.update_staff_id = '';
            this.tempUser.username = '';
            this.tempUser.departmentList = [];
            this.tempUser.positionList = [];
            this.tempUser.birthday = '';

            this.dialogStatus = "create"
            this.dialogStaffDetailsVisible = true
        },
        showUpdate($index) {
            // console.log('index:', $index);
            let user = this.list[$index];
            // console.log('user', user);
            this.tempUser.age = user.age;
            this.tempUser.userId = user.userId;
            // this.tempUser.certificateId = user.certificateId;
            this.tempUser.certificateId = user.certificateType;

            this.tempUser.certificateNumber = user.certificateNumber;
            this.tempUser.certificateType = user.certificateType;
            this.tempUser.contactEndDate = user.contactEndDate;
            this.tempUser.contactStartDate = user.contactStartDate;
            this.tempUser.createTime = user.createTime;
            this.tempUser.create_staff_id = user.create_staff_id;
            this.tempUser.degreeId = user.degreeId;
            if (user.degreeId === 1) {
                this.tempUser.degreeName = '小学';
            } else if (user.degreeId === 2) {
                this.tempUser.degreeName = '初中';
            } else if (user.degreeId === 3) {
                this.tempUser.degreeName = '高中';
            } else if (user.degreeId === 4) {
                this.tempUser.degreeName = '中专';
            } else if (user.degreeId === 5) {
                this.tempUser.degreeName = '大专';
            } else if (user.degreeId === 6) {
                this.tempUser.degreeName = '本科';
            } else if (user.degreeId === 7) {
                this.tempUser.degreeName = '硕士研究生';
            } else if (user.degreeId === 8) {
                this.tempUser.degreeName = '博士研究生';
            } else {
                this.tempUser.degreeName = '暂无学历';
            }

            this.tempUser.deleteStatus = user.deleteStatus;
            this.tempUser.departmentName = user.departmentName;
            this.tempUser.email = user.email;
            this.tempUser.emergencyPeople = user.emergencyPeople;
            this.tempUser.emergencyPhone = user.emergencyPhone;
            this.tempUser.entryTime = user.entryTime;
            this.tempUser.gender = user.gender;
            this.tempUser.graduated_from = user.graduated_from;
            this.tempUser.is_quit = user.is_quit;
            this.tempUser.leaveTime = user.leaveTime;
            this.tempUser.major = user.major;
            this.tempUser.birthday = user.birthday;
            // this.tempUser.marital_status = user.marital_status;
            if (user.marital_status == 1) {
                this.tempUser.marital_status = "未婚"
            }
            if (user.marital_status == 2) {
                this.tempUser.marital_status = "已婚"
            }
            if (user.marital_status == 3) {
                this.tempUser.marital_status = "丧偶"
            }
            if (user.marital_status == 4) {
                this.tempUser.marital_status = "离婚"
            }
            this.tempUser.nation = user.nation;
            this.tempUser.nationality = user.nationality;
            this.tempUser.native = user.native;
            this.tempUser.nickname = user.nickname;
            this.tempUser.phone = user.phone;
            this.tempUser.positionName = user.positionName;
            this.tempUser.probationEndDate = user.probationEndDate;
            this.tempUser.roleId = user.roleId;
            this.tempUser.roleName = user.roleName;
            this.tempUser.staffNameEn = user.staffNameEn;
            this.tempUser.staff_state = user.staff_state;

            if (user.staff_state == 1) {
                this.tempUser.staff_state_name = "实习员工";
            } else if (user.staff_state == 2) {
                this.tempUser.staff_state_name = "正式员工";
            } else if (user.staff_state == 3) {
                this.tempUser.staff_state_name = "离职员工";
            } else {
                this.tempUser.staff_state_name = "暂无此状态";
            }

            this.tempUser.updateTime = user.updateTime;
            this.tempUser.update_staff_id = user.update_staff_id;
            this.tempUser.userId = user.userId;
            this.tempUser.username = user.username;
            this.tempUser.departmentList = user.departmentList;
            this.tempUser.positionList = user.positionList;
            this.tempUser.posiId = user.posiId;
            console.log('uuuuuuuuuuuuuuuuuuu', this.tempUser);
            // return;
            this.dialogStatus = "update"
            this.dialogStaffDetailsVisible = true
        },
        showDetails($index) {
            // console.log('index:', $index);
            // console.log('duibi:', this.list);
            // console.log('duobi:', this.list[0]);
            // console.log('list:', this.list[$index]);

            let user = this.list[$index];
            // console.log('user', user);
            // return;
            this.tempUser.age = user.age;
            this.tempUser.certificateId = user.certificateType;
            this.tempUser.certificateNumber = user.certificateNumber;
            this.tempUser.certificateType = user.certificateType;
            if (user.contactEndDate == "" || user.contactEndDate == null) {
                this.tempUser.contactEndDate = "暂无";
            } else {
                this.tempUser.contactEndDate = user.contactEndDate;
            }
            if (user.contactStartDate == "" || user.contactStartDate == null) {
                this.tempUser.contactStartDate = "暂无";
            } else {
                this.tempUser.contactStartDate = user.contactStartDate;
            }
            this.tempUser.createTime = user.createTime;
            this.tempUser.create_staff_id = user.create_staff_id;
            this.tempUser.degreeId = user.degreeId;
            this.tempUser.birthday = user.birthday;
            console.log('this.tempUser:', this.tempUser);
            // return;
            if (user.degreeId === 1) {
                this.tempUser.degreeName = '小学';
            } else if (user.degreeId === 2) {
                this.tempUser.degreeName = '初中';
            } else if (user.degreeId === 3) {
                this.tempUser.degreeName = '高中';
            } else if (user.degreeId === 4) {
                this.tempUser.degreeName = '中专';
            } else if (user.degreeId === 5) {
                this.tempUser.degreeName = '大专';
            } else if (user.degreeId === 6) {
                this.tempUser.degreeName = '本科';
            } else if (user.degreeId === 7) {
                this.tempUser.degreeName = '硕士研究生';
            } else if (user.degreeId === 8) {
                this.tempUser.degreeName = '博士研究生';
            } else {
                this.tempUser.degreeName = '暂无学历';
            }
            this.tempUser.deleteStatus = user.deleteStatus;
            this.tempUser.departmentName = user.departmentName;
            this.tempUser.email = user.email;
            this.tempUser.emergencyPeople = user.emergencyPeople;
            this.tempUser.emergencyPhone = user.emergencyPhone;
            if (user.entryTime == "" || user.entryTime == null) {
                this.tempUser.entryTime = "暂无";
            } else {
                this.tempUser.entryTime = user.entryTime;
            }
            this.tempUser.gender = user.gender;
            this.tempUser.graduated_from = user.graduated_from;
            this.tempUser.is_quit = user.is_quit;
            if (user.leaveTime == "" || user.leaveTime == null) {
                this.tempUser.leaveTime = "暂无";
            } else {
                this.tempUser.leaveTime = user.leaveTime;
            }

            this.tempUser.major = user.major;
            // this.tempUser.marital_status = user.marital_status;
            if (user.marital_status == 1) {
                this.tempUser.marital_status = "未婚"
            }
            if (user.marital_status == 2) {
                this.tempUser.marital_status = "已婚"
            }
            if (user.marital_status == 3) {
                this.tempUser.marital_status = "丧偶"
            }
            if (user.marital_status == 4) {
                this.tempUser.marital_status = "离婚"
            }
            this.tempUser.nation = user.nation;
            this.tempUser.nationality = user.nationality;
            this.tempUser.native = user.native;
            this.tempUser.nickname = user.nickname;
            this.tempUser.phone = user.phone;
            this.tempUser.positionName = user.positionName;
            if (user.probationEndDate == "" || user.probationEndDate == null) {
                this.tempUser.probationEndDate = "暂无";
            } else {
                this.tempUser.probationEndDate = user.probationEndDate;
            }
            this.tempUser.roleId = user.roleId;
            this.tempUser.roleName = user.roleName;
            this.tempUser.staffNameEn = user.staffNameEn;
            this.tempUser.staff_state = user.staff_state;
            if (user.staff_state == 1) {
                this.tempUser.staff_state_name = "实习员工";
            } else if (user.staff_state == 2) {
                this.tempUser.staff_state_name = "正式员工";
            } else if (user.staff_state == 3) {
                this.tempUser.staff_state_name = "离职员工";
            } else {
                this.tempUser.staff_state_name = "暂无此状态";
            }
            // if(user.staff_state == 1){
            //   this.tempUser.staff_state = "实习员工";
            // }
            // else if(user.staff_state == 2){
            //   this.tempUser.staff_state = "正式员工";
            // }
            // else if(user.staff_state == 3){
            //   this.tempUser.staff_state = "离职员工";
            // }else{
            //   this.tempUser.staff_state = "暂无此状态";
            // }

            this.tempUser.updateTime = user.updateTime;
            this.tempUser.update_staff_id = user.update_staff_id;
            this.tempUser.userId = user.userId;
            this.tempUser.username = user.username;
            this.tempUser.departmentList = user.departmentList;
            this.tempUser.positionList = user.positionList;
            this.tempUser.posiId = user.posiId;
            this.dialogStatus = "details";
            // console.log('departmentList:',this.tempUser.departmentList);
            // console.log('tempUser::::', this.tempUser);
            // console.log('status:', this.dialogStatus);
            // return;
            this.projectByPersonFun();
            // return;
            this.dialogStaffDetailsVisible = true;

        },
        projectByPersonFun() {
            console.log('xxxx:', this.tempUser.userId);
            // return;
            this.api({
                url: "/user/getAllProjectsByPerson",
                method: "post",
                data: this.tempUser
            }).then(data => {
                console.log('projectByPerson:', data);
                this.projectByPerson = data.list;
                console.log('projectByPerson:', this.projectByPerson);
            })
            // alert("xxxxxxxxx");
        },
        showProjectDetails($index) {
            let project = this.projects[$index];

            project.status = this.dialogStatus;
            console.log('project:', project);
            // return;
            // var id = project.project_id;
            // console.log('tttttt', id);
            // this.$router.push({
            //   path: `/staff/staff/test/${id}`,
            // })

            // this.dialogProjectFormVisible = true;
            // return;
            this.$store.dispatch('SetProjectId', project).then(data => {
                this.listLoading = false
                console.log('data::::', data);
                if ("success" === data) {
                    console.log('ssss');
                    // this.$router.push({path: '/position/position'});
                    this.$router.push({ path: '/staff/staff/test' });
                    this.dialogProjectFormVisible = true;
                } else {
                    this.$message.error("我有点帅啊");
                }
            }).catch(() => {
                this.listLoading = false
            })
        },
        createUser() {
            //添加新用户

            var date = new Date(this.tempUser.birthday);
            this.tempUser.birthday = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
            console.log('tempUser', this.tempUser);

            // return;

            
            

            // 判断账号
            if (this.isChina(this.tempUser.username)) {
                this.open_alert("账号中禁止中文出现，由账号和字母组成！");
                return;
            }
            if (this.tempUser.username.length < 3 | this.tempUser.username.length > 15) {
                this.open_alert("账号位数在3~15位之间");
                return;
            }
            // 密码
            if (this.tempUser.password.length < 5 | this.tempUser.password.length > 15) {
                this.open_alert("密码位数在5~15位之间");
                return;
            }
            // 姓名
            if (this.tempUser.staffNameEn.length < 2 | this.tempUser.staffNameEn.length > 10 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("姓名位数在2~10位之间");
                return;
            }
            // 证件类型
            if(this.tempUser.certificateId == ""){
                this.open_alert("请选择证件类型");
                return;
            }
            // 证件号码
            if (isNaN(this.tempUser.certificateNumber)) {
                this.open_alert("证件号码禁止中文出现，必须为数字！");
                return;
            }

            if(this.tempUser.certificateId == 1){
                if(this.tempUser.certificateNumber.length != 18){
                    this.open_alert("请输入正确的身份证号码，18位");
                    return;
                }
            }

            if(this.tempUser.certificateId == 3){
                //如果是护照，则不为空就ok
                if(this.tempUser.certificateNumber == ""){
                    this.open_alert("请输入护照号码！");
                    return;
                }
            }
            // 性别
            if(this.tempUser.gender == ""){
                this.open_alert("请选择性别");
            }
            
            // 年龄
            if (isNaN(this.tempUser.age)) {
                this.open_alert("年龄禁止中文出现，必须为数字！");
                return;
            }
            if (this.tempUser.age < 0 | this.tempUser.age > 200) {
                this.open_alert("年龄范围0~200");
                return;
            }
            // 昵称
            if (this.tempUser.nickname.length < 3 | this.tempUser.nickname.length > 15) {
                this.open_alert("昵称应为3~15位");
                return;
            }
            // 生日
            if(this.tempUser.birthday == ""){
                this.open_alert("请选择生日");
                return;
            }
            // 部门
            if(this.tempUser.departmentName == ""){
                this.open_alert("请选择部门");
                return;
            }
            // 岗位
            if(this.tempUser.positionName == ""){
                this.open_alert("请选择岗位");
                return;
            }
            // 角色
            if(this.tempUser.roleId == ""){
                this.open_alert("请选择角色");
                return;
            }
            // 状态
            if(this.tempUser.staff_state == ""){
                this.open_alert("请选择员工状态");
                return;
            }
            // 学历
            if(this.tempUser.degreeId == ""){
                this.open_alert("请选择学历");
                return;
            }


            // 邮箱
            if (!this.isValidMail(this.tempUser.email)) {
                this.open_alert("邮箱格式错误");
                return;
            }
            // 毕业院校
            if (this.tempUser.graduated_from.length < 2 | this.tempUser.graduated_from.length > 20 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("毕业院校应为2~20位");
                return;
            }
            // 专业
            if (this.tempUser.major.length < 2 | this.tempUser.major.length > 20 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("专业应为2~20位");
                return;
            }
            // 民族
            if (this.tempUser.nation.length < 1 | this.tempUser.nation.length > 5) {
                this.open_alert("请填写正确的民族!");
                return;
            }
            if (this.hasNum(this.tempUser.nation)) {
                this.open_alert("请输入正确的民族！");
                return;
            }
            // 国籍
            if (this.tempUser.nationality.length < 1 | this.tempUser.nationality.length > 20 | this.hasNum(this.tempUser.nationality)) {
                this.open_alert("请输入正确的国籍！");
                return;
            }
            // 籍贯
            if (this.tempUser.native.length < 1 | this.tempUser.native.length > 40 | this.hasNum(this.tempUser.native)) {
                this.open_alert("请输入正确的籍贯，不能含有数字！");
                return;
            }
            // 联系电话
            if (!this.isPhoneNumber(this.tempUser.phone)) {
                this.open_alert("请填写正确的手机号码!");
                return;
            }
            // 紧急联系人
            if (this.tempUser.emergencyPeople.length < 2 | this.tempUser.emergencyPeople.length > 10 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("请填写正确的紧急联系人姓名!位数2~10");
                return;
            }
            // 紧急电话
            if (!this.isPhoneNumber(this.tempUser.emergencyPhone)) {
                this.open_alert("请填写正确的紧急电话号码!");
                return;
            }
            this.api({
                url: "/user/addUser",
                method: "post",
                data: this.tempUser
            }).then(() => {
                this.getList();
                this.dialogStaffDetailsVisible = false
            })
        },
        open_alert(msg) {
            this.$message.error(msg);
        },
        isChina(s) {
            if (escape(s).indexOf("%u") < 0) {
                return false;
            } else {
                return true;
            }
        },
        isValidMail(TextVal) {　　　　
            var Regex = /^(?:\w+\.?)*\w+@(?:\w+\.)*\w+$/;　　
            if (Regex.test(TextVal)) {　　 return true;　　 }　　
            else {　　
                if (TextVal == "") {　　 return false;　　 }　　
                else {　　 return false;　　 }　　
            }
        },
        hasNum(msg) {
            var a = /[0-9]/;
            return a.test(msg);
        },
        isPhoneNumber(tel) {
            var reg = /^0?1[3|4|5|6|7|8][0-9]\d{8}$/;
            return reg.test(tel);
        },
        updateUser() {
            //修改用户信息
            let _vue = this;
            console.log(this.tempUser);
            var date = new Date(this.tempUser.birthday);
            this.tempUser.birthday = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
            console.log(this.tempUser);
            // console.log('certificateId:', this.tempUser.certificateId);
            // return ;

            if (this.tempUser.certificateId === "居民身份证") {
                this.tempUser.certificateId = 1;
                // alert("居民身份证");
                // console.log('certificateId2222:', this.tempUser.certificateId);
            } else if (this.tempUser.certificateId === "出生证") {
                this.tempUser.certificateId = 2;
            } else if (this.tempUser.certificateId === "护照") {
                this.tempUser.certificateId = 3;
            } else if (this.tempUser.certificateId === "警官证") {
                this.tempUser.certificateId = 4;
            } else if (this.tempUser.certificateId === "执行公务证") {
                this.tempUser.certificateId = 5;
            } else if (this.tempUser.certificateId === "学生证") {
                this.tempUser.certificateId = 6;
            } else if (this.tempUser.certificateId === "毕业证") {
                this.tempUser.certificateId = 7;
            } else if (this.tempUser.certificateId === "签证") {
                this.tempUser.certificateId = 8;
            } else if (this.tempUser.certificateId === "结婚证") {
                this.tempUser.certificateId = 9;
            } else if (this.tempUser.certificateId === "离婚证") {
                this.tempUser.certificateId = 10;
            } else if (this.tempUser.certificateId === "独生子女证") {
                this.tempUser.certificateId = 11;
            } else if (this.tempUser.certificateId === "驾驶证") {
                this.tempUser.certificateId = 12;
            } else {
                // alert("啥都没有！");
                // console.log('certificateId0000:', this.tempUser.certificateId);
                // this.tempUser.certificateId = 0;
            }

            // console.log('maristate:',this.tempUser.marital_status );
            if (this.tempUser.marital_status === "未婚") {
                this.tempUser.marital_status = 1;
            } else if (this.tempUser.marital_status === "已婚") {
                this.tempUser.marital_status = 2;
                // console.log('2:',this.tempUser.marital_status );
            } else if (this.tempUser.marital_status === "丧偶") {
                this.tempUser.marital_status = 3;
            } else if (this.tempUser.marital_status === "离婚") {
                this.tempUser.marital_status = 4;
            }
            // else{
            //   this.tempUser.marital_status = 0;
            //   console.log('ooo:',this.tempUser.marital_status );
            // }
            // console.log('www:',this.tempUser.marital_status );
            // console.log("tempUser:",this.tempUser);
            // return ;
            if (typeof(this.tempUser.departmentName) === "string") {
                // console.log('dddd:', this.tempUser.departmentName)
                // let deptName = "sssssssssss";
                for (var i = 0; i < this.departments.length; i++) {
                    // console.log('name:', this.departments[i].department_name);
                    // console.log('id:', this.departments[i].department_id);

                    // console.log('real:', this.tempUser.departmentName);
                    if (this.departments[i].department_name === this.tempUser.departmentName) {
                        this.tempUser.departmentName = this.departments[i].department_id;
                    } else {
                        // alert("2222");
                    }
                }

            }
            if (typeof(this.tempUser.positionName) === "string") {
                // console.log('dddd:', this.tempUser.positionName)
                // let deptName = "sssssssssss";
                // console.log('real:', this.tempUser.positionName);
                for (var i = 0; i < this.positions.length; i++) {
                    // console.log('name:', this.positions[i].position_name);
                    // console.log('id:', this.positions[i].position_id);

                    // console.log('real:', this.tempUser.positionName);
                    if (this.positions[i].position_name === this.tempUser.positionName) {
                        this.tempUser.positionName = this.positions[i].position_id;
                    } else {
                        // alert("2222");
                    }
                }
            }

            console.log('updateTmpUser', this.tempUser);
            // return;

            // 判断账号
            if (this.isChina(this.tempUser.username)) {
                this.open_alert("账号中禁止中文出现，由账号和字母组成！");
                return;
            }
            if (this.tempUser.username.length < 3 | this.tempUser.username.length > 15) {
                this.open_alert("账号位数在3~15位之间");
                return;
            }

            // 姓名
            if (this.tempUser.staffNameEn.length < 2 | this.tempUser.staffNameEn.length > 10 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("姓名位数在2~10位之间");
                return;
            }
            // 证件号码
            if (isNaN(this.tempUser.certificateNumber)) {
                this.open_alert("证件号码禁止中文出现，必须为数字！");
                return;
            }
            if (this.tempUser.certificateNumber.length < 5 | this.tempUser.certificateNumber.length > 20) {
                this.open_alert("证件号码位数在5~20位之间");
                return;
            }
            // 年龄
            if (isNaN(this.tempUser.age)) {
                this.open_alert("年龄禁止中文出现，必须为数字！");
                return;
            }
            if (this.tempUser.age < 0 | this.tempUser.age > 200) {
                this.open_alert("年龄范围0~200");
                return;
            }
            // 昵称
            if (this.tempUser.nickname.length < 3 | this.tempUser.nickname.length > 15) {
                this.open_alert("昵称应为3~15位");
                return;
            }

            // 邮箱
            if (!this.isValidMail(this.tempUser.email)) {
                this.open_alert("邮箱格式错误");
                return;
            }
            // 毕业院校
            if (this.tempUser.graduated_from.length < 2 | this.tempUser.graduated_from.length > 20 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("毕业院校应为2~20位");
                return;
            }
            // 专业
            if (this.tempUser.major.length < 2 | this.tempUser.major.length > 20 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("专业应为2~20位");
                return;
            }
            // 民族
            if (this.tempUser.nation.length < 2 | this.tempUser.nation.length > 5) {
                this.open_alert("请填写正确的民族!");
                return;
            }
            if (this.hasNum(this.tempUser.nation)) {
                this.open_alert("请输入正确的民族！");
                return;
            }
            // 国籍
            if (this.tempUser.nationality.length < 1 | this.tempUser.nationality.length > 20 | this.hasNum(this.tempUser.nationality)) {
                this.open_alert("请输入正确的国籍！");
                return;
            }
            // 籍贯
            if (this.tempUser.native.length < 1 | this.tempUser.native.length > 40 | this.hasNum(this.tempUser.native)) {
                this.open_alert("请输入正确的籍贯，不能含有数字！");
                return;
            }
            // 联系电话
            if (!this.isPhoneNumber(this.tempUser.phone)) {
                this.open_alert("请填写正确的手机号码!");
                return;
            }
            // 紧急联系人
            if (this.tempUser.emergencyPeople.length < 2 | this.tempUser.emergencyPeople.length > 10 | this.hasNum(this.tempUser.emergencyPeople)) {
                this.open_alert("请填写正确的紧急联系人姓名!位数2~10");
                return;
            }
            // 紧急电话
            if (!this.isPhoneNumber(this.tempUser.emergencyPhone)) {
                this.open_alert("请填写正确的紧急电话号码!");
                return;
            }



            this.api({
                url: "/user/updateUser",
                method: "post",
                data: this.tempUser
            }).then(() => {
                let msg = "修改成功";
                // return 
                this.dialogStaffDetailsVisible = false
                if (this.userId === this.tempUser.userId) {
                    msg = '修改成功,部分信息重新登录后生效'
                }
                this.$message({
                    message: msg,
                    type: 'success',
                    duration: 1 * 1000,
                    onClose: () => {
                        _vue.getList();
                    }
                })
            })
        },
        removeUser($index) {
            let _vue = this;
            // console.log(_vue.list);
            this.$confirm('确定删除此用户?', '提示', {
                confirmButtonText: '确定',
                showCancelButton: false,
                type: 'warning'
            }).then(() => {
                if (!this.hasPerm('user:delete')) {
                    alert("不具备删除权限");
                    return;
                }
                return;
                let user = _vue.list[$index];
                // console.log(user)
                user.deleteStatus = '2';
                if (user.certificateId === "居民身份证") {
                    user.certificateId = 1;
                    // alert("居民身份证");
                    // console.log('certificateId2222:', this.tempUser.certificateId);
                } else if (user.certificateId === "出生证") {
                    user.certificateId = 2;
                } else if (user.certificateId === "护照") {
                    user.certificateId = 3;
                } else if (user.certificateId === "警官证") {
                    user.certificateId = 4;
                } else if (user.certificateId === "执行公务证") {
                    user.certificateId = 5;
                } else if (user.certificateId === "学生证") {
                    user.certificateId = 6;
                } else if (user.certificateId === "毕业证") {
                    user.certificateId = 7;
                } else if (user.certificateId === "签证") {
                    user.certificateId = 8;
                } else if (user.certificateId === "结婚证") {
                    user.certificateId = 9;
                } else if (user.certificateId === "离婚证") {
                    user.certificateId = 10;
                } else if (user.certificateId === "独生子女证") {
                    user.certificateId = 11;
                } else if (user.certificateId === "驾驶证") {
                    user.certificateId = 12;
                } else {
                    // alert("啥都没有！");
                    // console.log('certificateId0000:', this.tempUser.certificateId);
                    // this.tempUser.certificateId = 0;
                }

                // console.log('maristate:',this.tempUser.marital_status );
                if (user.marital_status === "未婚") {
                    user.marital_status = 1;
                } else if (user.marital_status === "已婚") {
                    user.marital_status = 2;
                    // console.log('2:',this.tempUser.marital_status );
                } else if (user.marital_status === "丧偶") {
                    user.marital_status = 3;
                } else if (user.marital_status === "离婚") {
                    user.marital_status = 4;
                }
                // else{
                //   this.tempUser.marital_status = 0;
                //   console.log('ooo:',this.tempUser.marital_status );
                // }
                // console.log('www:',this.tempUser.marital_status );
                // console.log("tempUser:",this.tempUser);
                // return ;
                if (typeof(user.departmentName) === "string") {
                    // console.log('dddd:', this.tempUser.departmentName)
                    // let deptName = "sssssssssss";
                    for (var i = 0; i < this.departments.length; i++) {
                        // console.log('name:', this.departments[i].department_name);
                        // console.log('id:', this.departments[i].department_id);

                        // console.log('real:', this.tempUser.departmentName);
                        if (this.departments[i].department_name === user.departmentName) {
                            user.departmentName = this.departments[i].department_id;
                        } else {
                            // alert("2222");
                        }
                    }

                }
                if (typeof(user.positionName) === "string") {
                    // console.log('dddd:', this.tempUser.positionName)
                    // let deptName = "sssssssssss";
                    // console.log('real:', this.tempUser.positionName);
                    for (var i = 0; i < this.positions.length; i++) {
                        // console.log('name:', this.positions[i].position_name);
                        // console.log('id:', this.positions[i].position_id);

                        // console.log('real:', this.tempUser.positionName);
                        if (this.positions[i].position_name === user.positionName) {
                            user.positionName = this.positions[i].position_id;
                        } else {
                            // alert("2222");
                        }
                    }
                }
                console.log('user:', user);
                // return;
                _vue.api({
                    url: "/user/updateUser",
                    method: "post",
                    data: user
                }).then(() => {
                    _vue.getList()
                }).catch(() => {
                    _vue.$message.error("删除失败")
                })
            })
        },
    }
}
</script>

<style>
.text {
    font-size: 14px;
}

.item {
    padding: 18px 0;
}

.box-card {
    width: 480px;
}

.transfer-footer {
    margin-left: 20px;
    padding: 6px 5px;
}

.el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
}

.el-table .warning-row {
    background: oldlace;
}

.el-table .success-row {
    background: #f0f9eb;
}

i {
    font-style: normal;
}
</style>
